package com.ruoyi.fs.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.fs.mapper.FsTodoListMapper;
import com.ruoyi.fs.domain.FsTodoList;
import com.ruoyi.fs.service.IFsTodoListService;

/**
 * 代办事项Service业务层处理
 * 
 * @author hero
 * @date 2024-09-09
 */
@Service
public class FsTodoListServiceImpl implements IFsTodoListService 
{
    @Autowired
    private FsTodoListMapper fsTodoListMapper;

    /**
     * 查询代办事项
     * 
     * @param id 代办事项主键
     * @return 代办事项
     */
    @Override
    public FsTodoList selectFsTodoListById(Long id)
    {
        return fsTodoListMapper.selectFsTodoListById(id);
    }

    /**
     * 查询代办事项
     *
     * @param bh 代办事项主键
     * @return 代办事项
     */
    @Override
    public FsTodoList selectFsTodoListByBh(String bh)
    {
        FsTodoList query=new FsTodoList();
        query.setBh(bh);
        List<FsTodoList> list=fsTodoListMapper.selectFsTodoListList(query);
        if (list.isEmpty()) {
            return null;
        } else {
            return list.get(0);
        }
    }

    /**
     * 查询代办事项列表
     * 
     * @param fsTodoList 代办事项
     * @return 代办事项
     */
    @Override
    public List<FsTodoList> selectFsTodoListList(FsTodoList fsTodoList)
    {
        return fsTodoListMapper.selectFsTodoListList(fsTodoList);
    }

    /**
     * 新增代办事项
     * 
     * @param fsTodoList 代办事项
     * @return 结果
     */
    @Override
    public int insertFsTodoList(FsTodoList fsTodoList)
    {
        fsTodoList.setCreateTime(DateUtils.getNowDate());
        return fsTodoListMapper.insertFsTodoList(fsTodoList);
    }

    /**
     * 修改代办事项
     * 
     * @param fsTodoList 代办事项
     * @return 结果
     */
    @Override
    public int updateFsTodoList(FsTodoList fsTodoList)
    {
        fsTodoList.setUpdateTime(DateUtils.getNowDate());
        return fsTodoListMapper.updateFsTodoList(fsTodoList);
    }

    /**
     * 批量删除代办事项
     * 
     * @param ids 需要删除的代办事项主键
     * @return 结果
     */
    @Override
    public int deleteFsTodoListByIds(Long[] ids)
    {
        return fsTodoListMapper.deleteFsTodoListByIds(ids);
    }

    /**
     * 删除代办事项信息
     * 
     * @param id 代办事项主键
     * @return 结果
     */
    @Override
    public int deleteFsTodoListById(Long id)
    {
        return fsTodoListMapper.deleteFsTodoListById(id);
    }
}
